API Documentation
Public Member Functions | List of all members
nkAstraeus::EffectManager Class Referencefinal

Manages the effects available in the component. More...

Inheritance diagram for nkAstraeus::EffectManager:

Public Member Functions

EffectcreateOrRetrieve (const nkMemory::StringView &name, EFFECT_TYPE type)
 
Effectget (const nkMemory::StringView &name)
 
EffectgetByIndex (unsigned int id)
 
void rename (const nkMemory::StringView &currentName, const nkMemory::StringView &newName)
 
void erase (const nkMemory::StringView &name)
 

Detailed Description

Manages the effects available in the component.

At all times, manager owns any memory allocated inside. External code should never delete memory returned by it.

Member Function Documentation

◆ createOrRetrieve()

Effect* nkAstraeus::EffectManager::createOrRetrieve ( const nkMemory::StringView name,
EFFECT_TYPE  type 
)

Creates if unavailable, or retrieves if available, an effect.

Depending on the parameter given for the type, the Effect instance retrieved will be :

ValuePointer type
EFFECT_TYPE::FILM_GRAINFilmGrainEffect
EFFECT_TYPE::FXAAFxaaEffect
EFFECT_TYPE::SSAOSsaoEffect

To address it fully, casting is required. For instance :

FxaaEffect* effect = (FxaaEffect*)EffectManager::getInstance()->createOrRetrieve("effect", EFFECT_TYPE::FXAA) ;
Parameters
nameThe name of the effect to retrieve.
typeThe effect type to create.
Returns
The effect requested, possibly freshly created. The manager owns the memory returned, external code should never delete it. See erase().

◆ get()

Effect* nkAstraeus::EffectManager::get ( const nkMemory::StringView name)

Retrieves an effect.

Parameters
nameThe name of the effect to retrieve.
Returns
The material effect if available, nullptr else.

◆ getByIndex()

Effect* nkAstraeus::EffectManager::getByIndex ( unsigned int  id)

Get an effect, by index. Note that one index can map to a different effect after memory is changed. Useful to loop over all available effect in one go.

Parameters
idThe index of the effect to retrieve.
Returns
The effect linked if available, nullptr else.

◆ rename()

void nkAstraeus::EffectManager::rename ( const nkMemory::StringView currentName,
const nkMemory::StringView newName 
)

Renames an effect.

Parameters
currentNameThe name of the effect to rename.
newNameThe name to reassign to the effect.

◆ erase()

void nkAstraeus::EffectManager::erase ( const nkMemory::StringView name)

Erases and frees an effect.

Parameters
nameThe name of the effect to erase.

The documentation for this class was generated from the following file: